package cn.qin.Actions;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import cn.qin.Models.admin;
import cn.qin.Services.newsServices;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class loginAction extends ActionSupport {
	admin admin =new admin();
	newsServices newsServices=new newsServices();
	
	public String execute(){
		if(newsServices.login(admin))
		{
			HttpSession hs=ServletActionContext.getRequest().getSession();
			hs.setAttribute("name", admin.getName());
			return SUCCESS;
		}
		else 
			return Action.LOGIN;
		}

	public admin getAdmin() {
		return admin;
	}

	public void setAdmin(admin admin) {
		this.admin = admin;
	}
}
